import { dnsName, projectName } from './global.js'
const Request = {};

// var dnsName = 'http://127.0.0.1:3003/plantknow';
//获取书籍的请求

Request.get = function(url, data, callback) {
	uni.request({
		url: `${dnsName}${projectName}${url}`,
		data: data,
		method: 'GET',
		success: (res) => {
			callback && callback(res);
		}
	})
}

Request.post = function(url, data, callback) {
	uni.request({
		url: `${dnsName}${projectName}${url}`,
		data: data,
		method: 'POST',
		header: {'Content-Type': 'application/x-www-form-urlencoded'},
		success: (res) => {
			callback && callback(res);
		}
	})
}

Request.put = function(url, data, callback) {
	uni.request({
		url: `${dnsName}${projectName}${url}`,
		data: data,
		method: 'PUT',
		header: {'Content-Type': 'application/x-www-form-urlencoded'},
		success: (res) => {
			callback && callback(res);
		}
	})
}


module.exports = Request;
